import React from "react"
import { createBrowserRouter, Navigate } from "react-router-dom"

const Layout = React.lazy(() => import("../layout"))
const Dashborad = React.lazy(() => import("../pages/dashboard"))
const Typography = React.lazy(() => import("../pages/typography"))

// 403
const Page403 = React.lazy(() => import("../pages/403"))
// 404
const Page404 = React.lazy(() => import("../pages/404"))

const router = createBrowserRouter([
  {
    path: "/",
    element: <Navigate to="/dashboard" />,
  },
  {
    path: "/",
    element: <Layout />,
    children: [
      {
        path: "/dashboard",
        element: <Dashborad />,
      },
      {
        path: "/typography",
        element: <Typography />,
      },
    ],
  },
  {
    path: "/403",
    element: <Page403 />,
  },
  {
    path: "*",
    element: <Page404 />,
  },
])

export default router
